/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

/**
 * 支持的源码类型
 *
 * @since 2022/2/25
 */
import { ComponentPath } from '@ohos/sdkmanager-common';

import { OhosLogger } from '../utils/log/ohos-logger.js';

const _log = OhosLogger.getLogger('CodeType');

export enum CodeType {
  JS = 'js',
  ETS = 'ets',
  CPP = 'cpp',
}

/**
 * SDK 分类
 *
 * @since 2023/05/12
 */
export enum SdkTypeEnum {
  HOS = 'HOS',
  OHOS = 'OHOS',
  ARKUI_X = 'ARKUI-X',
}

/**
 * 为枚举类附加特定方法
 *
 * @since 2022/1/26
 */
export namespace CodeType {
  export function getSDKComponentName(codeType: CodeType): string {
    switch (codeType) {
      case CodeType.CPP.toLowerCase():
        return ComponentPath.NATIVE;
      case CodeType.ETS.toLowerCase():
        return ComponentPath.ETS;
      case CodeType.JS.toLowerCase():
        return ComponentPath.JS;
      default:
        _log._buildError(`This type ${codeType} of source code is not supported!`)._solution('Value should be one of: "js", "ets", "cpp"')._printErrorAndExit();
        return '';
    }
  }
}
